<template>
  <div class="InfoItemList b-list">
    <div class="list-item">
      <div class="b-item-img" :data-id="book.id" @click='goChapters'>
        <img :src="book.img?book.img:'img/zanwu.jpg'" :alt="book.title">
      </div>
      <div class="b-item-right" :data-id="book.id" @click='goChapters'>
        <div class="b-item-title">{{book.title}}</div>
        <text class="b-item-des">{{book.des}}</text>
        <div class="b-item-info">
          <img class="icon-read" src="img/reader.png">
          <div class="b-item-type">{{book.type}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    props: ['book'],
    name: "BookCard",
    methods: {
      goChapters() {
        this.$router.push(`/chapter/${this.book.id}`)
      }
    }
  }
</script>

<style lang="scss" scoped>
  @import "../assets/styles/global";

  .InfoItemList {
    clear: both;
    list-style: none;
    padding: 0;
    margin-bottom: 0;
    overflow: hidden;
  }

  .InfoItemList .list-item {
    position: relative;
    padding: rpx2rem(32);
    font-size: 0;
  }

  .b-item-img {
    display: inline-block;
    width: rpx2rem(150);
    height: rpx2rem(200);
    margin-right: rpx2rem(24);
    vertical-align: middle;
  }

  .b-item-img img {
    width: 100%;
    height: 100%;
  }

  .b-item-right {
    display: inline-block;
    width: calc(100% - 100px);
    vertical-align: middle;
  }

  .b-item-right .b-item-title {
    font-size: rpx2rem(38);
    color: #242424;
    text-align: left;
    margin-bottom: rpx2rem(16);
  }

  .b-item-right .b-item-des {
    display: -webkit-box;
    width: 100%;
    font-size: rpx2rem(34);
    line-height: rpx2rem(40);
    color: #8f8f8f;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: justify;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .b-item-right .b-item-info {
    position: relative;
  }

  .b-item-right .b-item-type {
    float: left;
    display: block;
    margin-left: rpx2rem(8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #8f8f8f;
    font-size: rpx2rem(30);
    text-align: left;
  }

  .b-item-right .icon-read {
    float: left;
    position: relative;
    display: block;
    width: rpx2rem(28);
    height: rpx2rem(28);
    left: 0;
    top: rpx2rem(10);
  }

  .InfoItemList .list-item::after {
    position: absolute;
    display: inline-block;
    content: "";
    width: calc(100% - 32px);
    left: rpx2rem(32);
    right: 0;
    height: rpx2rem(2);
    bottom: 0;
    -webkit-transform: scaleY(0.5);
    -ms-transform: scaleY(0.5);
    transform: scaleY(0.5);
    -webkit-transform-origin: 0 100%;
    -ms-transform-origin: 0 100%;
    transform-origin: 0 100%;
    pointer-events: none;
    background-color: #e5e5e5;
  }

  .InfoItemList .list-item::after {
    position: absolute;
    display: inline-block;
    content: "";
    width: calc(100% - 64px);
    left: rpx2rem(32);
    right: 0;
    height: rpx2rem(2);
    bottom: 0;
    -webkit-transform: scaleY(0.5);
    -ms-transform: scaleY(0.5);
    transform: scaleY(0.5);
    -webkit-transform-origin: 0 100%;
    -ms-transform-origin: 0 100%;
    transform-origin: 0 100%;
    pointer-events: none;
    background-color: #e5e5e5;
  }

  .InfoItemList .b-view-more {
    height: rpx2rem(88);
    line-height: rpx2rem(88);
    font-size: rpx2rem(30);
    color: #666;
    text-align: center;
  }

</style>